#pragma once


namespace zy
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename RBTree<K,const K, SetKeyOfT>::Iterator iterator;
		typedef typename RBTree<K,const K, SetKeyOfT>::Const_Iterator const_iterator;

		iterator begin()
		{
			return _t.Begin();
		}
		iterator end()
		{
			return _t.End();
		}
		const_iterator begin() const
		{
			return _t.Begin();
		}
		const_iterator end() const
		{
			return _t.End();
		}

		pair<iterator, bool> insert(const K& k)
		{
			return _t.Insert(k);
		}
	private:
		RBTree<K,const K,SetKeyOfT> _t;
	};

	void func(const set<int>& s)
	{
		set<int>::const_iterator cit = s.begin();
		while (cit != s.end())
		{
			cout << *cit << " ";
			++cit;
		}
		cout << endl;
	}

	void test_set1()
	{
		set<int> s;
		s.insert(1);
		s.insert(8);
		s.insert(9);
		s.insert(5);

		func(s);
	}
}
